module.exports = function ($scope, $state, $resource,$modalInstance, $modal, toaster,item,flag ){
    
        
        init();
        function init(){
          
            $scope.info = flag ? {'flag': true} : item;
            if($scope.info.departure_mode = '0'){
                $scope.info.departure_mode_name = '飞机'
            }else if($scope.info.departure_mode = '1'){
                $scope.info.departure_mode_name = '火车'
            }else if($scope.info.departure_mode = '2'){
                $scope.info.departure_mode_name = '轮船'
            }else if($scope.info.departure_mode = '3'){
                $scope.info.departure_mode_name = '汽车'
            }else if($scope.info.departure_mode = '4'){
                $scope.info.departure_mode_name = '无'
            }
    
            if($scope.info.return_mode	 = '0'){
                $scope.info.return_mode_name = '飞机'
            }else if($scope.info.return_mode	 = '1'){
                $scope.info.return_mode_name = '火车'
            }else if($scope.info.return_mode	 = '2'){
                $scope.info.return_mode_name = '轮船'
            }else if($scope.info.return_mode	 = '3'){
                $scope.info.return_mode_name = '汽车'
            }else if($scope.info.return_mode	 = '4'){
                $scope.info.return_mode_name = '无'
            }
           
        }
    
    
        $scope.updateagreeInfo = function(){
            var para = {
                'code':$scope.info.code,
                'remark':$scope.info.remark
            }
            $resource('/api/as/goc/tourbase/updateagreeInfo', {}, {}).save(para,function (res) {
                console.log($scope.info);
                if(res.errcode === 0){
                    toaster.success({title: '', body: '操作成功'});
                    $modalInstance.close();
                }else{
                    toaster.error({title: '', body: res.errmsg});
                }
                   
            });
        }
        $scope.updatedisagreeInfo = function(){
            if($scope.info.remark == undefined){
                toaster.error({title: '', body: '请输入审核理由！'});
              return;
            }
            var para = {
                'code':$scope.info.code,
                'remark':$scope.info.remark
            }
            $resource('/api/as/goc/tourbase/updatedisagreeInfo', {}, {}).save(para,function (res) {
                console.log($scope.info);
                if(res.errcode === 0){
                    toaster.success({title: '', body: '操作成功'});
                    $modalInstance.close();
                }else{
                    toaster.error({title: '', body: res.errmsg});
                }
                   
            });
        }
        
        $scope.cancel = function () {
            $modalInstance.dismiss('cancel');
        }
    }